<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  let web = { name: 'baidu', url: 'web' }

  //  注意解构是把前面的值分解赋值给后面的值，name:a , url:b ,即把web中 name的值赋值给=>a,如果 a, b 和原始名字相同则可以简写,如果解构的值不存在娜美就会被赋值undefined
  let { name, url } = web
  console.log(name, url);

  // 数组的结构语言
  let arr = ['hello', 'world']

  let [a] = arr;

  console.log(a)

  let [, b] = arr

  console.log(b)

  // 对象的简写
  let name2 = 'hello', url2 = 'www.baidu.com'
  let opt = { name2, url2 }
  console.log(opt.name)

</script>

</html>